package com.example.springboot.service.impl;

import com.example.springboot.entity.User;
import com.example.springboot.mapper.UserMapper;
import com.example.springboot.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 小申
 * @since 2023-08-14
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {


    @Override
    public boolean saveOrUpdate(User user) {
        if(user.getId()==null) {
            user.setActivityLen(0);
            user.setCollectionLen(0);
            user.setFansLen(0);
            user.setFocosLen(0);
            save(user);
        } else {
            updateById(user);
        }

        return true;
    }


}
